<template>
    <div class="box-column container-grid">
        <ux-header-search
            ref="searchHeader"
            v-bind="enquiryData"
            :btnsData="{ permissionsData }"
            @search="onQueryClick"
        ></ux-header-search>
        <div class="box-flex1 table">
            <vxe-grid
                v-bind="tableConfig"
                :data="dataStore.data"
                :columns="table.columns"
            >
                <template v-slot:operate="{ row }">
                    <ux-btn-group
                        :btns="table.btns"
                        :data="{ row, permissionsData }"
                    ></ux-btn-group>
                </template>
            </vxe-grid>
        </div>
        <div class="pagination-el box-row box-center-end">
            <el-pagination
                @size-change="onSizeChange"
                @current-change="onCurrentChange"
                :current-page="dataStore.proxy.page"
                :page-size="dataStore.proxy.pageSize"
                :page-sizes="dataStore.pageSizes"
                :total="dataStore.pagination.total"
                :layout="'total, sizes, prev, pager, next, jumper'"
            ></el-pagination>
        </div>
    </div>
</template>

<script  lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { Action } from 'vuex-class';
import { mixinTableStore } from '@/mixin/table/Store';
import { mixinTableHeader } from '@/mixin/table/Header';
import { mixinTableOperation } from '@/mixin/table/Operation';
import { mixinDialogFormParent } from '@/mixin/dialog/FormParent';
import { mixinAccess } from '@/mixin/Access';
@Component({
    mixins: [
        mixinTableStore,
        mixinTableHeader,
        mixinTableOperation,
        mixinDialogFormParent,
        mixinAccess
    ],
    components: {

    }
})
export default class CertifyOpenTable extends Vue {
    @Action('equipmentDoorCertify/del') itemDel: any;
    @Action('equipmentDoorCertify/list') getList: any;

    table: any = {
        btns: [
            {
                label: '删除',
                condition: ['permissionsData.del'],
                handleClick: (this as any).onDelClick
            }
        ],
        // 列配置
        columns: [
            {
                fixed: 'left',
                width: 70,
                type: 'seq',
                title: '序号'
            },
            {
                fixed: 'left',
                min: 180,
                title: '门禁名称',
                field: 'door_name'
            },
            {
                fixed: 'left',
                min: 130,
                title: '门禁GUID',
                field: 'door_guid'
            },
            {
                title: '手机号',
                field: 'certify_phone',
                width: 150
            },
            {
                title: '开门人员openId',
                field: 'certify_openid',
                min: 180
            },
            {
                title: '认证方式',
                field: 'certify_type',
                width: 80,
                formatter: function ({ cellValue }) {
                    return ["", "微信", "支付宝"][cellValue];
                }
            },
            {
                width: 150,
                title: '开门时间',
                field: 'updated_at'
            },
            {
                showOverflow: 'ellipsis',
                fixed: 'right',
                slots: { default: 'operate' },
                title: '操作',
                width: 120
            }
        ]
    };
    // 查询头配置
    enquiryData: any = {
        fields: [
            {
                field: 'certify_phone',
                label: '手机号'
            }
        ]
    };
}
</script>
